﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace Projektkylsim
{
    public partial class Form1 : Form
    {
        private Graphics _canvas;
        private Nod n = new Nod();
        private Nod n1 = new Nod(30, 350, false, "N1", 5);
        private Nod n2 = new Nod(300, 350, true, "N2", 1);
        private Nod n3 = new Nod(525, 350, false, "N3", 1);
        private Ventil v1 = null;
        private Ventil v2 = null;

        public string Klocka { get; set; }

        public Form1()
        {
            InitializeComponent();

            this._canvas = this.CreateGraphics();
            v1 = new Ventil(n1, n2, 150, 385);
            v2 = new Ventil(n2, n3, 400, 385);
          
        }


        private void Form1_Paint(object sender, PaintEventArgs e)
        {

            Pen pen = new Pen(Color.Gray);
            _canvas.DrawLine(pen, 45, 360, 150, 360);
            _canvas.DrawLine(pen, 210, 360, 300, 360);
            _canvas.DrawLine(pen, 315, 360, 400, 360);
            _canvas.DrawLine(pen, 450, 360, 525, 360);
            n1.rita(_canvas);
            n2.rita(_canvas);
            n3.rita(_canvas);
            v1.rita(_canvas);
            v2.rita(_canvas);

        }

        private void timer_Tick(object sender, EventArgs e)
        {
            n1.dynamik();
            n2.dynamik();
            n3.dynamik();
            v1.dynamik(n);
            v2.dynamik(n);

            
        }


        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void stängaToolStripMenuItem_MouseDown(object sender, MouseEventArgs e)
        {

        }

        private void öppnaToolStripMenuItem_MouseDown(object sender, MouseEventArgs e)
        {

        }

       


      

    }
}
